
#!/bin/bash
. /etc/profile
. ~/.bash_profile

if [ $# -lt 2 ]
then
echo  " check_commitusetime.sh  datatype time" 
exit 0
fi

currentDateStr=`date +%Y-%m-%d`

type="$1"
time="$2"
file=""

dateStr=`echo "$time" |awk '{print $1}'`

cd /home/ulss/project/dpl-data-indexer/log

if [ "$dateStr" = "$currentDateStr" ]
then
file="Indexer.log"
else
file=`echo "Indexer.log.$dateStr"|awk '{print $1}'`
fi



echo -e   "check commit timeout: $type \"$time\",the commit statics data is:"

grep "increase doc num" $file >.commit

count=`grep "increase doc num" .commit  |wc -l`
echo "total num:$count"


timeoutcount=`grep "increase doc num" .commit |grep "$type" |grep "$time" |awk '{if($15>=500) {print $15}}' |wc -l`
echo "more than 500 ms num:$timeoutcount"

timeoutcount=`grep "increase doc num" .commit |grep "$type" |grep "$time" |awk '{if($15>=3000) {print $15}}' |wc -l`
echo "more than 3000 ms num:$timeoutcount"


timeoutcount=`grep "increase doc num" .commit |grep "$type" |grep "$time" |awk '{if($15>=5000) {print $15}}' |wc -l`
echo "more than 5000 ms num:$timeoutcount"

grep "increase doc num" .commit |grep "$type" |grep "$time" |awk '{if($15>=3000) {print }}'
